package alpaca;

import javax.swing.UIManager;

import alpaca.config.IConfigurator;
import alpaca.config.PropertyConfigurator;
import alpaca.core.ServerModel;
import alpaca.core.ServerModelLocator;
import alpaca.database.IDatabaseSystem;
import alpaca.database.ORMLiteDatabaseSystem;
import alpaca.network.IClientConnection;
import alpaca.network.KryoClientConnection;
import alpaca.textprocessor.ITextProcessor;
import alpaca.textprocessor.URLTextProcessor;
import alpaca.view.GUIBuilder;

public class ServerMain {

	public static void main(String[] args) {
	    try {
	        UIManager.setLookAndFeel(
	            UIManager.getSystemLookAndFeelClassName());
	    } catch (Exception e) { }
	    
	    //Creation of subsystems
	    IClientConnection clientConn = new KryoClientConnection();
	    IDatabaseSystem databaseSystem = new ORMLiteDatabaseSystem();
	    ITextProcessor textProcessor = new URLTextProcessor();
	    IConfigurator configurator = new PropertyConfigurator();
	    
	    ServerModelLocator.setServerModel(new ServerModel(clientConn, databaseSystem, textProcessor, configurator));

		GUIBuilder guiBuilder = new GUIBuilder();				
		guiBuilder.create();
	}

}
